The standard method used when generating 3 dimensional images for shading and texturing is the z or depth buffer system. This has been in use for many years and is now an industry standard.
In our British Patent No. 2281682, we have proposed an alternative method with many advantages over the z buffer system. It is a ray casting technique in which each object (polygon) in an image is defined by a set of infinite surfaces which are tagged as forward or reverse facing. A ray from a viewpoint is cast into the scene and intersections with the surfaces are determined along with the distance of the intersections from an image plane. By analysing this data, it is possible to determine which surface of each polygon is visible for each pixel and thus it is possible to shade and texture the pixel. The technique may be implemented by using a pipeline of processing elements, each of which can perform a ray surface interception calculation to determine the depth value for that surface for each pixel in turn. When the depth value for a surface at a pixel has been determined, using these processing elements it is stored in a depth or z buffer with data identifying the surface. The z buffer information can then be read out and used by a texturing device to apply texture data for display via a frame store.
Surfaces in the system can be opaque or they may have translucency. Blending values can be associated with the surfaces to enable translucency effects to be displayed. For example, a cloud may be modelled as a translucent surface by assigning the RGB values to define its colour and an alpha blending value to define its translucency. The degree of translucency is controlled by modulating the alpha value of the texture map across the surface. A commonly used blending mode is known as alpha blending where successive polygons are blended into the frame buffer and put into the equation:RGB(new)=alpha*RGB(frame buffer)+(1−alpha)*RGB(texture) 
This technique is well known. A restriction when using alpha blending is, that in order to render a correctly blended image, the pixels which display the polygons must be presented to the blending unit in depth order rendered from back to front so that each contribute the correct amount for the final image. For a z buffer system, this ordering is typically performed by the application software that is feeding the z buffer. This is referred to as pre-sort mode. The ray casting technique can use either the pre-sort mode or an automatic pixel accurate type of sort.
There is a special case of translucent texture referred to as “punch through”. This is defined as a translucent texture where the alpha component is restricted to be either “on”, i.e., fully transparent, or “off”, i.e., fully opaque. This type of texture is very common in 3-D game applications for two reasons; firstly it allows complex scenes like forests to be modelled using relatively few polygons; a nd, secondly, a traditional z buffer can correctly render punch through translucency irrespective of the order in which polygons are presented to the system.
A traditional z buffer pipeline with alpha testing for translucency is shown in FIG. 1. In this, polygons to be rendered are first scan line converted in the polygon scan converter 2 and the resulting x, y, z, u, v, w values are then fed to the texturing unit and to the depth test unit (the z buffer). Texture addresses are sent to texture memory. Texture values retrieved from texture memory pass to a texture filter 4 which reduces aliasing artifacts introduced by the texture resampling process. The filtered values are passed to a texture blend unit 6 which blends the texture values with the base colour and highlights of the polygon. Next, an alpha test is performed on the alpha component of the resulting pixel in an alpha test unit 8. The test is against a reference alpha value.
The alpha test unit performs a magnitude comparison with an alpha reference value. The user supplies the alpha reference value, and a compare mode which is one of “never”, “less”, “equal”, “less or equal”, “greater”, “not equal”, “greater or equal”, or “always”. The test selected depends on the type of image the user is creating. The alpha test unit outputs whether or not the compare mode has been passed or failed by the input alpha value.
If the result of the alpha test is a pass, then the depth test is performed on the z value and RGB values in the z buffer updated. If the test is failed, then no further processing of pixels takes place. Thus, in the typical case where the reference alpha is one and the test is greater than or equal, then only opaque pixels are written to the frame buffer, and these pixels are depth tested against all other polygons in the scene, irrespective of the order in which polygons are processed. The depth test is performed by a depth test unit 10 which reads z values from the z buffer 12 via a stencil unit 14 and is able to write the z values directly to the z buffer store. The depth test conditions are shown in FIG. 1 next to the depth test unit.
FIG. 2 shows the ray casting technique of our British Patent No. 2281682 with deferred texturing, that is to say, texturing data is applied at the end of the ray/surface intersection testing process. The apparatus comprises a polygon set-up unit which provides data which defines the plane equations of the polygons. This data is then fed to an array of processing elements 22, each of which is able to perform one ray/surface intersection test and can produce a depth value for that ray/surface intersection. Typically, the processing array operates on a sub-set of the whole image known as a “tile” which is e.g., 32×32 pixels and operates on one polygon at a time. The depth values computed are stored in a tile depth store 24.
Depth and surface values from the tile depth store are applied to a parallel runlength encoder 26. Encoder 26 provides an output to the texturing unit via an XY address for a pixel which is fed to a polygon scan conversion unit 28 and a tag which goes to the polygon setup unit 30. Unite 30 calculates the plane equations for the texturing and shading, and recalculates the plane equations of the polygons.
The polygon setup unit 30 receives the polygon texture data and then provides data to the polygon scan conversion unit 28. The RGB values and alpha values and highlights applied to a surface are then sent to a texture blending unit 32 where they are combined with RGB and alpha values from texture memory via a filter 34 and are then passed to the tile accumulation buffer 38. From buffer 38 the combined RGB and alpha data are sent to the main frame store for the image.
The advantage of deferring texturing until all the ray/surface intersections have been performed is that texture and shading operations then only occur on visible pixels. Thus, effective fill rate it increased by the ratio of occluded to visible pixels in the scene. By definition, in a deferred texturing pipeline the depth test occurs before the texturing takes place and, therefore, also takes place before the alpha test. As a result, it is not possible to correctly render the punch through textured polygons unless they are either presented in back to front order and are non-overlapping, or they are subject to a pixel accurate pre-sorting operation earlier in the pipeline. The first of these arrangements imposes an unnecessary restriction in the software driver. The second requires an unnecessary processing overhead.